00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00048 #ifndef GL2D_H_INCLUDED
00049 #define GL2D_H_INCLUDED
00050
00051
00052
00053
00054
00055
00056
00057
00058
00065 #define GL2D_RGBA( r, g, b, a ) RGBA( b, g, r, a )
00066
00072 #define GL2D_RGB( r, g, b ) RGBA( b, g, r, 255 )
00073
00074
00075
00076
00077
00078
00079
00080
00100 enum GL2D_FLIP_MODE
00101 {
00102
00103 FLIP_NONE = 1 shl 0,
00104 FLIP_V = 1 shl 1,
00105 FLIP_H = 1 shl 2
00107 };
00108
00109
00114 enum GL2D_BLEND_MODE
00115 {
00116
00117 BLEND_TRANS = 0,
00118 BLEND_SOLID,
00119 BLEND_BLENDED,
00120 BLEND_GLOW,
00121 BLEND_ALPHA,
00122 BLEND_BLACK
00125 };
00126
00150 struct Image
00151 {
00152
00153 integer width;
00154 integer height;
00155 single u_offset;
00156 single v_offset;
00157 single texture_width;
00158 single texture_height;
00160 GLuint textureID;
00162 };
00163
00164
00168 sub Begin2D();
00169
00170
00174 sub End2D();
00175
00181 sub ScreenInit( byval as integer width, byval as integer height, byval as integer flags = 0 );
00182
00186 sub ShutDown();
00187
00191 sub VsynchOn();
00192
00198 function LimitFPS( byval as single max_FPS );
00199
00203 sub SetBlendMode( byval as GL2D_BLEND_MODE mode );
00204
00214 sub EnableSpriteStencil( byval as integer flag, byval as GLuint gl2dcolor, byval as GLuint gl2dcolor_env );
00215
00219 sub EnableAntialias( byval as integer flag = 1);
00220
00222 sub ClearScreen();
00223
00231 sub LineGlow( byval as integer x1, byval as integer y1,
00232 byval as integer x2, byval as integer y2,
00233 byval as integer width, byval as GLuint color,
00234 byval as image ptr spr = 0 );
00235
00241 sub Pset( byval as integer x, byval as integer y, byval as GLuint color );
00242
00248 sub Line( byval as integer x1, byval as integer y1, byval as integer x2, byval as integer y2, byval as GLuint color );
00249
00256 sub LineGradient( int x1, int y1, int x2, int y2,
00257 const GLuint color1, const GLuint color2 );
00258
00264 sub Box( byval as integer x1, byval as integer y1, byval as integer x2, byval as integer y2, byval as GLuint color );
00265
00271 sub BoxFilled( byval as integer x1, byval as integer y1, byval as integer x2, byval as integer y2, byval as GLuint color );
00272
00281 sub BoxFilledGradient( byval as integer x1, byval as integer y1, byval as integer x2, byval as integer y2,
00282 byval as GLuint color1, byval as GLuint color2,
00283 byval as GLuint color3, byval as GLuint color4 );
00284
00291 sub Triangle( byval as integer x1, byval as integer y1, byval as integer x2, byval as integer y2, byval as integer x3, byval as integer y3, byval as GLuint color );
00292
00299 sub TriangleFilled( byval as integer x1, byval as integer y1, byval as integer x2, byval as integer y2, byval as integer x3, byval as integer y3, byval as GLuint color );
00300
00309 sub TriangleFilledGradient( byval as integer x1, byval as integer y1, byval as integer x2, byval as integer y2, byval as integer x3, byval as integer y3,
00310 byval as GLuint color1, byval as GLuint color2, byval as GLuint color3 );
00311
00319 sub Ellipse( byval as integer x, byval as integer y, byval as integer a, byval as integer b, byval as integer degrees, byval as GLuint color );
00320
00328 sub EllipseFilled( byval as integer x, byval as integer y, byval as integer a, byval as integer b, byval as integer degrees, byval as GLuint color );
00329
00330
00331
00332
00339 sub Sprite( byval as integer x, byval as integer y, byval as integer flipmode, byval as Image ptr spr );
00340
00348 sub SpriteScale( byval as integer x, byval as integer y, byval as single scale, byval as integer flipmode, byval as Image ptr spr );
00349
00358 sub SpriteScaleXY( byval as integer x, byval as integer y, byval as single scaleX, byval as single scaleY, byval as integer flipmode, byval as Image ptr spr );
00359
00367 sub SpriteRotate( byval as integer x, byval as integer y, byval as integer angle, byval as integer flipmode, byval as Image ptr spr );
00368
00369
00378 sub SpriteRotateScale( byval as integer x, byval as integer y, byval as integer angle, byval as single scale, byval as integer flipmode, byval as Image ptr spr );
00379
00380
00390 sub SpriteRotateScaleXY( byval as integer x, byval as integer y, byval as integer angle, byval as single scaleX, byval as single scaleY, byval as integer flipmode, byval as Image ptr spr );
00391
00392
00401 sub SpriteOnBox( byval as integer x1, byval as integer y1,
00402 byval as integer x2, byval as integer y2,
00403 byval as single uoff, byval as single voff,
00404 byval as integer flipmode, byval as Image ptr spr );
00405
00416 sub SpriteOnQuad( byval as integer x1, byval as integer y1,
00417 byval as integer x2, byval as integer y2,
00418 byval as integer x3, byval as integer y3,
00419 byval as integer x4, byval as integer y4,
00420 byval as single uoff, byval as single voff,
00421 byval as integer flipmode, byval as Image ptr spr );
00422
00423
00430 sub SpriteStretchHorizontal( byval as integer x, byval as integer y, byval as integer length, byval as Image ptr spr );
00431
00432
00439 sub SpriteStretchVertical( byval as integer x, byval as integer y, byval as integer height, byval as Image ptr spr );
00440
00448 sub SpriteStretch( byval as integer x, byval as integer y, byval as integer length, byval as integer height, byval as Image ptr spr );
00449
00456 sub PrintScale( byval as integer x, byval as integer y, byval as single scale, byref const as string text, byval as GLuint color );
00457
00458
00466 sub overload InitSprites( Image ptr SpriteSet(),
00467 Uinteger Texcoords(),
00468 byref filename as string,
00469 byval as GLuint filtermode = GL_NEAREST);
00470
00471
00480 sub overload InitSprites( Image ptr SpriteSet(),
00481 byval as integer tile_wid,
00482 byval as integer tile_hei,
00483 byref filename as string,
00484 byval as GLuint filtermode = GL_NEAREST);
00485
00490 sub DestroySprites( Image ptr Spriteset() );
00491
00497 function LoadBmpToGLsprite( byref as string filename,
00498 byval as GLuint filtermode = GL_NEAREST);
00499
00505 function LoadImageToHW( byval as Image ptr spr, byval as GLuint filtermode = GL_NEAREST );
00506
00513 sub GetImage( byval Image ptr SpriteDest, byval as Image ptr SpriteSource, byval as integer x1, byval as integer y1, byval as integer x2, byval as integer y2 );
00514
00523 sub FontLoad( byval as integer glyph_width, byval as integer glyph_height,
00524 byval as integer fontoffset, byref as string filename, byval as GLuint filter_mode = GL_NEAREST );
00525
00526 #endif // GL2D_H_INCLUDED